<p>When using the <code>Stream</code> API, call chains should be simplified as much as possible. Not only does it make the code easier to read, it
also avoid creating unnecessary temporary objects.</p>
<p>This rule raises an issue when one of the following substitution is possible:</p>
<table>
  <tbody>
    <tr>
      <th>Original</th>
      <th>Preferred</th>
    </tr>
    <tr>
      <td>{code}stream.filter(predicate).findFirst().isPresent(){code}</td>
      <td>{code}stream.anyMatch(predicate){code}</td>
    </tr>
    <tr>
      <td>{code}stream.filter(predicate).findAny().isPresent(){code}</td>
      <td>{code}stream.anyMatch(predicate){code}</td>
    </tr>
    <tr>
      <td>{code}!stream.anyMatch(predicate){code}</td>
      <td>{code}stream.noneMatch(predicate){code}</td>
    </tr>
    <tr>
      <td>{code}!stream.anyMatch(x -&gt; !(...)){code}</td>
      <td>{code}stream.allMatch(...){code}</td>
    </tr>
    <tr>
      <td>{code}stream.map(mapper).anyMatch(Boolean::booleanValue){code}</td>
      <td>{code}stream.anyMatch(predicate){code}</td>
    </tr>
  </tbody>
</table>
<h2>Noncompliant Code Example</h2>
<pre>
boolean hasRed = widgets.stream().filter(w -&gt; w.getColor() == RED).findFirst().isPresent(); // Noncompliant
</pre>
<h2>Compliant Solution</h2>
<pre>
boolean hasRed = widgets.stream().anyMatch(w -&gt; w.getColor() == RED);
</pre>

